<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>系统常态化运行评分系统</title>
  <link rel="stylesheet" href="../component/pear/css/pear.css"/>
  <style>
    h1{
      margin-top: 200px;
      color: #5FB878;
    }

    .layui-href {
      color:blue;
	  }
	  .layui-href:hover{
      color:blue;
	    text-decoration:underline;
	 }


  </style>
</head>
<body class="pear-container">
<div class="layui-card">
    <img src="../admin/images/home.png" width="100%">
    <!-- 分成两部分，一部分是通知，一部分是制度汇编 -->
    <div class="layui-row">
      <div class="layui-col-md6">
          <div class="layui-card">
             <div class="layui-card-header" style="text-align: center"><h4>通知</h4></div>
             <div class="layui-card-body">
              <table id="user-table-tz" lay-filter="user-table"></table>
            </div>
          </div>
      </div>
      <div class="layui-col-md6">
        <div class="layui-card">
          <div class="layui-card-header" style="text-align: center"><h4>文件汇编</h4></div>
          <div class="layui-card-body">
            <table id="user-table-zd" lay-filter="user-table"></table>
         </div>
       </div>
      </div>
    </div>
</div>
</body>
<script src="../component/layui/layui.js"></script>
<script src="../component/pear/pear.js"></script>
<script src="../scripts/utils/request.js"></script>
<script src="../scripts/utils/auth.js"></script>
<script>
  function navite(obj,id){
    console.log($(obj).text());
    parent.layui.admin.addTab(id,"消息-"+$(obj).text(),"./page/news/newsinfo.html?id="+id)
  }

var $,table,form,drawer,popup,notice,laydate
layui.use(['table', 'form', 'jquery', 'drawer', 'popup','notice','laydate'], function() {
  table = layui.table;
  form = layui.form;
  $ = layui.jquery;
  drawer = layui.drawer;
  popup = layui.popup;
  notice = layui.notice;
  laydate= layui.laydate;

  function initTableData(ele,newsType){
    table.render({
        id:ele,
        elem: '#'+ele,
        url: baseURL+'/api/news/listShow',
        method:'post',
        contentType: 'application/json',
        page: {
          layout: ['count','page']
        },
        loading:true,
        headers: {
            token: localStorage.getItem("token")
        },
        request: {
            pageName: 'pageIndex', // page
            limitName: 'pageSize', // limit
        },
        where:{
            state:2,
            newsType:newsType
        },
        cols: [[
            {field: 'title', minWidth: 300, style:'text-align:left;', title: '标题',templet:function(d){
              return "<a class='layui-href' href='javascript:void(0)' onclick=\"navite(this,'"+d.id+"')\">"+d.title+"</a>"
            }},
            {field: 'pulishTime', width: 120, title: '发布时间'}
        ]],
        skin: 'line',
        height: "540",
        done: function(res, curr, count) {
            validToken(res);
            $('.layui-table-header').remove();
        }
    });
  }

  initTableData('user-table-tz',1)
  initTableData('user-table-zd',2)




  
});

</script>
</html>
